
const baseUrl="https://tea.qingnian8.com/api/bizhi";
export function request(config={}){
	let {
		url,
		method="GET",
		data={},
		header={}} = config
	url=baseUrl+url;
	header['access-key']="lwh2580@";
	return new Promise((resolve,request)=>{
		uni.request({
		  url,
		  method,
		  data,
		  header,
		  success:res=>{
			  if(res.data.errCode===0){
				resolve(res.data)
			  }else if(res.data.errCode===400){
				uni.showModal({
					title:"错误提示",
					content:res.data.errMsg,
					showCancel:false
				})
				reject(res.data)
			  }else{
				  uni.showModal({
				  	title:res.data.errMsg,
					icon:"none"
				  })
				  reject(res.data)
			  }
			  
		  },
		  fail:err=>{
			  reject(err)
		  }
		});
	})
	
}